package com.wanxi.step07test.mapper;

import com.wanxi.step07test.model.Permission;
import com.wanxi.step07test.model.SUser;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface SUserMapper {
    /**
     * 根据用户名获得用户数据
     * @param name 登陆账号 保证唯一性
     * @return
     */
    List<SUser> getSUserByName(String name);

    /**
     * 根据用户id获取该用户有哪些权限
     * @param sUserId
     * @return
     */
    List<Permission> getPermissionBySUserId(Integer sUserId);

    int add(SUser sUser);

    SUser findByName(String username);

    SUser findById(Integer id);

    int saveSUserAndRole(Integer sUserId, Integer[] roleIds);


    List<SUser> findAll(SUser sUser);

    List<SUser> findAllEmail();

    int count(SUser sUser);

    int delete(SUser sUser);
    int deleteSUserAndRole(SUser sUser);


    int update(SUser sUser);

    int updatePassword(SUser sUser);
//
//    int updateSUserAndRole(Integer sUserId, Integer[] roleIds);
}
